# -*- coding: utf-8 -*-
"""
Created on Mon Jul 23 21:16:35 2018

@author: 君
"""
import json
ls = open('获取失败的学校.txt','r',encoding='utf-8').readlines()
idList = {}
for line in ls:
    a = json.loads(line)
    if a["id"] in a:
        continue
    else:
        idList[a["id"]] = a["学校"]
        print(a["id"],a["学校"])
print(idList)
file = open('还未获取的学校ID.txt','w',encoding='utf-8')
str = json.dumps(idList)
#写入文件，将数据放置缓存区中
file.write(str + '\n')
#关闭文件，将缓存区数据写入文件，关闭文件
file.close()